package src.Packets;

import src.Main;
import src.Players.*;

public class DropItem
{
    public DropItem(Player p)
    {
        if(p == null)
        {
            return;
        }
        int itemId = p.inStream.readUnsignedWordA();
        int unknown = p.inStream.readUnsignedByte() + p.inStream.readUnsignedByte();
        int itemSlot = p.inStream.readUnsignedWordA();
        if((p.items[itemSlot] - 1) != itemId)
        {
            return;
        }
        if(!Main.m.ge.item.isUntradable(itemId))
        {
            PlayerItems pi = new PlayerItems();
            Main.m.ge.item.createGroundItem(itemId, p.itemsN[itemSlot], p.absX, p.absY, p.heightLevel, p.username);
            pi.deleteItem(p, itemId, itemSlot, p.itemsN[itemSlot]);
            pi = null;
        }
    }
}